<%@ page language="java" contentType="text/html; charset=utf-8"
    pageEncoding="utf-8"%>
<%@ taglib prefix="s" uri="/struts-tags" %>

<html>
<head>
<title>计价系统</title>
<!-- 新 Bootstrap 核心 CSS 文件 -->
<link rel="stylesheet" href="${ pageContext.request.contextPath }/css/bootstrap.min.css">

<!-- 可选的Bootstrap主题文件（一般不用引入） -->
<link rel="stylesheet" href="${ pageContext.request.contextPath }/css/bootstrap-theme.min.css">

<style type="text/css">
	body{
	padding-top:70px;
	}
</style>
</head>
<body>

	<nav class="navbar navbar-inverse navbar-fixed-top">
      <div class="container">
        <div class="navbar-header">
          <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar" aria-expanded="false" aria-controls="navbar">
            <span class="sr-only">Toggle navigation</span>
            <span class="icon-bar"></span>
            <span class="icon-bar"></span>
            <span class="icon-bar"></span>
          </button>
          <a class="navbar-brand" href="#">螃蟹计价系统</a>
        </div>
        
        <!-- Collect the nav links, forms, and other content for toggling -->
	    <div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
	      
	      <ul class="nav navbar-nav">
	        <li><a href="${ pageContext.request.contextPath }/index.jsp">首页</a></li>
	        
	        <li class="dropdown">
	          <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">清单创建 <span class="caret"></span></a>
	          <ul class="dropdown-menu">
	            <li><a href="${ pageContext.request.contextPath }/crab_list.do?isOrder=1">收货清单</a></li>
	            <li><a href="${ pageContext.request.contextPath }/crab_list.do?isOrder=0">出货清单</a></li>
	          </ul>
	        </li>
	        
	        <li class="dropdown">
	          <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">今日汇总 <span class="caret"></span></a>
	          <ul class="dropdown-menu">
	            <li><a href="${ pageContext.request.contextPath }/order_searchByDate.do?isOrder=1">收货清单</a></li>
	            <li><a href="${ pageContext.request.contextPath }/order_searchByDate.do?isOrder=0">出货清单</a></li>
	            <li role="separator" class="divider"></li>
	            <li><a href="${ pageContext.request.contextPath }/order_searchNumberByDate.do">规格比较</a></li>
	          </ul>
	        </li>
	        
	        <li class="dropdown">
	          <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">清单查询 <span class="caret"></span></a>
	          <ul class="dropdown-menu">
	            <li><a href="${ pageContext.request.contextPath }/order_search.do?isOrder=1">收货清单</a></li>
	            <li><a href="${ pageContext.request.contextPath }/order_search.do?isOrder=0">出货清单</a></li>
	            <li><a href="${ pageContext.request.contextPath }/order_searchNumberByTimeUI.do">规格查询</a></li>
	          </ul>
	        </li>
	        
	      </ul>
	     
	      <ul class="nav navbar-nav navbar-right">	
	        <li class="dropdown">
	          <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">用户 <span class="caret"></span></a>
	          <ul class="dropdown-menu">
	            <li><a href="${ pageContext.request.contextPath }/user_updateUI.do?userid=1">修改用户</a></li>
	          </ul>
	        </li>
	      </ul>
	    </div><!-- /.navbar-collapse -->
       
      </div>
   </nav>
    
	<div class="container" id="content">
		<div class="row-fluid">
			<div class="span12">
			<div class="row clearfix">
				<div class="col-md-6 column">
				<h3 class="text-center">
					<s:property value="#order.user.company"/>(客户联)
				</h3>
				<div class="col-md-4"></div>
	    		<div class="col-md-4"></div>
	    		<div class="col-md-4">
					ID:<s:property value="#order.id" />
	    		</div>
				<div class="col-md-4">
					客户：<s:property value="#order.clientName" />
	    		</div>
	    		<div class="col-md-4"></div>
	    		<div class="col-md-4">
					日期:<s:property value="#order.date" />
	    		</div>
	    		
				<table class="table table-bordered">
					<thead>
						<tr>
							<th>
								规格
							</th>
							<th>
								数量
							</th>
							<th>
								单价
							</th>
							<th>
								金额
							</th>
							<th>
								备注
							</th>
						</tr>
					</thead>
					<tbody>
						<s:iterator value="#order.crabList">
						<tr>
							<td>
								${name }
							</td>
							<td>
								${number }
							</td>
							<td>
								${crabPrice.price }
							</td>
							<td>
								${totalPrice }
							</td>
							<td>
								${note }
							</td>
						</tr>
						</s:iterator>
					</tbody>
				</table> 
				
				<div class="row clearfix">
					<div class="col-md-8 column">
						总计：共<s:property value="#order.totalNumber" />斤,共<s:property value="#order.totalPay" />元,均价: <s:property value="#order.meanPrice" />元/斤
					</div>
			    	<div class="col-md-4 column">
			    		实际支付：<s:property value="#order.realPay"/>
			    	</div>
			    </div>   
				<br/>
				<div class="row clearfix">
					<div class="col-md-12 column">
						<address> 
							<s:if test="#order.user.username != null && #order.user.username != '' ">
								<strong>联系人：</strong><s:property value="#order.user.username"/>&nbsp;&nbsp;&nbsp;
							</s:if>
							<s:if test="#order.user.address != null && #order.user.address != '' ">
								<strong>地址：</strong><s:property value="#order.user.address"/>&nbsp;&nbsp;&nbsp;
							</s:if>
							<s:if test="#order.user.phone != null && #order.user.phone != '' ">
								<strong>电话：</strong><s:property value="#order.user.phone"/>
							</s:if>
						</address> 
					</div>
			    </div>   	

		    	</div>
		    	
		    	<div class="col-md-6 column">
				<h3 class="text-center">
					<s:property value="#order.user.company"/>(存根联)
				</h3>
				<div class="col-md-4"></div>
	    		<div class="col-md-4"></div>
	    		<div class="col-md-4">
					ID:<s:property value="#order.id" />
	    		</div>
				<div class="col-md-4">
					客户：<s:property value="#order.clientName" />
	    		</div>
	    		<div class="col-md-4"></div>
	    		<div class="col-md-4">
					日期:<s:property value="#order.date" />
	    		</div>
				<table class="table table-bordered">
					<thead>
						<tr>
							<th>
								规格
							</th>
							<th>
								数量
							</th>
							<th>
								单价
							</th>
							<th>
								金额
							</th>
							<th>
								备注
							</th>
						</tr>
					</thead>
					<tbody>
						<s:iterator value="#order.crabList">
						<tr>
							<td>
								${name }
							</td>
							<td>
								${number }
							</td>
							<td>
								${crabPrice.price }
							</td>
							<td>
								${totalPrice }
							</td>
							<td>
								${note }
							</td>
						</tr>
						</s:iterator>
					</tbody>
				</table> 
				
				<div class="row clearfix">
					<div class="col-md-8 column">
						总计：共<s:property value="#order.totalNumber" />斤,共<s:property value="#order.totalPay" />元,均价: <s:property value="#order.meanPrice" />元/斤
					</div>
			    	<div class="col-md-4 column">
			    		实际支付：<s:property value="#order.realPay"/>
			    	</div>
			    </div>   
				<br/>
				<div class="row clearfix">
					<div class="col-md-12 column">
						<address> 
							<s:if test="#order.user.username != null && #order.user.username != '' ">
								<strong>联系人：</strong><s:property value="#order.user.username"/>&nbsp;&nbsp;&nbsp;
							</s:if>
							<s:if test="#order.user.address != null && #order.user.address != '' ">
								<strong>地址：</strong><s:property value="#order.user.address"/>&nbsp;&nbsp;&nbsp;
							</s:if>
							<s:if test="#order.user.phone != null && #order.user.phone != '' ">
								<strong>电话：</strong><s:property value="#order.user.phone"/>
							</s:if>
						</address> 
					</div>
			    </div>   	

		    	</div>
		    	</div>
				 
			</div>
		</div>
	</div>
	
	<div class="container">
		<div class="row clearfix">
		   	<div class="col-md-4 column"></div>
		   	<div class="col-md-4  column">
		   		<button type="button" class="btn btn-default"  id="printbtn">进行打印</button>
		   		<s:if test="#radio==1">
					<a class="btn btn-default" href="order_searchByTime.do?time=<s:property value='#time' />&isOrder=<s:property value='#isOrder'/>" role="button">退出</a>
				</s:if>
				<s:elseif test="#radio==2">
					<a class="btn btn-default" href="order_searchByName.do?name=<s:property value='#order.clientName' />&isOrder=<s:property value='#isOrder'/>" role="button">退出</a>
				</s:elseif>
				<s:elseif test="#radio==3">
					<a class="btn btn-default" href="order_search.do?isOrder=<s:property value='#isOrder'/>" role="button">退出</a>
				</s:elseif>
				<s:else>
					<a class="btn btn-default" href="order_searchByDate.do?isOrder=<s:property value='#isOrder'/>" role="button">退出</a>
				</s:else>
		   	</div>
		   	<div class="col-md-4 column"></div>
		</div>
	</div>

</body>
</html>
<script src="${ pageContext.request.contextPath }/js/jquery.min.js"></script>
<script src="${ pageContext.request.contextPath }/js/bootstrap.min.js"></script>
<script src="${ pageContext.request.contextPath }/js/jquery.printFinal.js"></script>
 
 <script  type="text/javascript"> 
    $(function(){ 
	  function print(preview){
	     $("#content").printFinal({
			preview: preview,//打印预览
            impcss: true//引入css文件							 
		});
	  }

      $("#printbtn").click(function(){//打印按钮
	            print(false);   
	  });

	  $("#previewbtn").click(function(){//预览按钮
	            print(true);   
	  });

}); 
</script> 